<template>
  <div>
    <h1>Login Page</h1>
    <input v-model="username" type="text" placeholder="Username" />
    <input v-model="password" type="password" placeholder="Password" />
    <button @click="handleLogin">Login</button>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
import { ref } from 'vue'

export default {
  name: 'LoginPage',
  setup() {
    const router = useRouter()
    const username = ref('')
    const password = ref('')

    const handleLogin = () => {
      // 添加登录验证逻辑
      if (username.value === 'admin' && password.value === 'admin') {
        router.push({ name: 'HomePage' })
      } else {
        alert('Invalid credentials')
      }
    }

    return {
      username,
      password,
      handleLogin
    }
  }
}
</script>